package com.irate.service;

import org.apache.http.Header;

import com.irate.http.AsyncHttpClient;
import com.irate.http.AsyncHttpResponseHandler;
import com.irate.http.PersistentCookieStore;
import com.irate.http.RequestParams;

public class AsyncHTTPRest {

	private static AsyncHttpClient client = new AsyncHttpClient();

	public static void setCookie(PersistentCookieStore persistentCookieStore) {
		client.setCookieStore(persistentCookieStore);
	}
	public static void get(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		client.get(url, params, responseHandler);
	}

	public static void get(String url, Header [] headers , RequestParams params, AsyncHttpResponseHandler responseHandler){
		client.get(null, url, headers, params, responseHandler);
	}
	

	public static void post(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		client.post(url, params, responseHandler);
	}

	public static void post(String url, Header [] headers , RequestParams params, AsyncHttpResponseHandler responseHandler){
		
		client.post(null, url, headers, params, "application/x-www-form-urlencoded", responseHandler);
	}
	
public static void post(String url, Header [] headers , RequestParams params, String content_type, AsyncHttpResponseHandler responseHandler){
		
		client.post(null, url, headers, params, content_type, responseHandler);
	}

	public static AsyncHttpClient getAsynHttpClient(){
		return client;
	}

}